package com.itheima.oneToMany;

import com.itheima.bean.Classes;

import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ClassesMapper {
    @Select("select * from classes ")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(column = "name",property = "name"),
            @Result(property = "students", column = "id",
                    javaType = List.class,
                    many = @Many(select = "com.itheima.oneToMany.StudentMapper.findByCid")
            ),
    })
    public abstract List<Classes> findAll() ;
}
